<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('假条审批')" />
    <link rel="stylesheet" href="../../../../../../../../../../../../css/navigation.css">
</head>
<body class="gray-bg">
<div class="navigation visible-xs-block">
    <ol class="breadcrumb">
        <span> > </span>
        <li><a href="#" onclick="gomain()">主页</a></li>
        <li style="color: black">假条审批</li>
    </ol>
    <div class="aLine"></div>
</div>
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>假条类型：</label>
                                <select name="lType" th:with="type=${@dict.getType('exa_leave_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>请假原因：</label>
                                <input type="text" name="lReason"/>
                            </li>
                            <li class="select-time">
                                <label style="width: 100px">请假开始时间：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginLTimeStart]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endLTimeStart]"/>
                            </li>
                            <li class="select-time">
                                <label style="width: 100px">请假结束时间：</label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginLTimeEnd]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endLTimeEnd]"/>
                            </li>
                            <li>
                                <label>请假人：</label>
                                <input type="text" name="lTheHeir"/>
                            </li>
                            <li>
                                <label>备注：</label>
                                <input type="text" name="lRemark"/>
                            </li>
                            <li>
                                <label>假条状态：</label>
                                <select name="lStatus" th:with="type=${@dict.getType('exa_approve_status')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>审批意见：</label>
                                <input type="text" name="lOpinion"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
              <!--  <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="ruoyi:leaveVerify:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="ruoyi:leaveVerify:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="ruoyi:leaveVerify:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>-->
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="ruoyi:leaveVerfiy:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script src="../../../../../../../../../../../../js/breadcrumb.js"></script>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('ruoyi:leaveVerify:edit')}]];
        var removeFlag = [[${@permission.hasPermi('ruoyi:leaveVerify:remove')}]];
        var subFlag = [[${@permission.hasPermi('ruoyi:leaveVerify:sub')}]];
        var prefix = ctx + "ruoyi/leaveVerify";
        //请假状态字典
        var approve = [[${@dict.getType('exa_approve_status')}]];
        //假条类型字典
        var leavet = [[${@dict.getType('exa_leave_type')}]];

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                subUrl: prefix + "/sub",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                showColumns: false,
                modalName: "假条审批",
                columns: [
                {
                    field: 'id', 
                    title: '假条id',
                    visible: false
                },
                    {
                        field: 'lTheHeir',
                        title: '申请人'
                    },
                    {
                        field: 'lPicture',
                        title: '申请人头像',
                        align: 'center',
                        formatter: function(value, row, index) {
                            return $.table.imageView(value);
                        }
                    },
                {
                    field: 'lType', 
                    title: '假条类型',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(leavet, value);
                    }
                },
                {
                    field: 'lReason', 
                    title: '请假原因'
                },
                {
                    field: 'lTimeStart', 
                    title: '请假开始时间'
                },
                {
                    field: 'lTimeEnd', 
                    title: '请假结束时间'
                },

                {
                    field: 'lDepa',
                    title: '申请人部门'
                },
                {
                    field: 'lCreator',
                    title: '创建人',
                    visible: false
                },

                {
                    field: 'lRemark', 
                    title: '备注'
                },
                {
                    field: 'lStatus', 
                    title: '假条状态',
                    align: 'center',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(approve, value);
                    }
                },
                {
                    field: 'lOpinion', 
                    title: '审批意见'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if (row.lStatus ==1){
                            actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="consent(\'' + row.id + '\')"><i class="fa fa-user"></i> 通过</a> ');
                            actions.push('<a class="btn btn-warning btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>驳回</a> ');

                        }

                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);                       
        });
        function consent(id) {

            $.modal.confirm("确认要通过申请吗?", function() {
                var url = prefix + "/consent";
                var data = { "id": id };
                $.operate.submit(url, "post", "json", data);
            });
        }
    </script>
</body>
</html>